<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Workkefucursor extends Model
{
    protected $table = 'work_kefu_cursor';
    protected $primaryKey = 'id';

    public static function getKfListsLastCursor($corp_id)
    {
        return self::select("cursor")->where("corp_id",$corp_id)->first();
    }

    public static function updateKfListsLastCursor($corp_id,$cursor)
    {
        return self::where("corp_id",$corp_id)->update(["cursor"=>$cursor]);
    }

    public static function createKfListsLastCursor($corp_id,$cursor)
    {
        return self::insert(["corp_id"=>$corp_id,"cursor"=>$cursor,"created_at"=>time()]);
    }
}